package com.qf.aop;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author Wy
 * @version V1.0
 * @Project MavenDemo
 * @Package com.qf.aop
 * @Description:
 * @Date 2022/6/7 20:12
 */
//声明这个类是一个切面类，里面包含切入点和(pointcut)和通知(advice)
@Aspect
//注册成为Spring的javabean
@Component
public class Testaop {
    //配置切入点
    @Pointcut("execution(* com.qf.service.UserServiceImpl.UserServiceImpl2.*(..))")
    public void pc(){}
    @Before("pc()")
    public void myBefore(){
        System.out.println("===执行了befor前置通知,相当于开方法开事务====");
    }
    @After("pc()")
    public  void myAfter(){
        System.out.println("后置事务");
    }

}
